#ifndef C3DSIMPORTER_H_
#define C3DSIMPORTER_H_

#include "c3dsfileidentifications.h"
#include "../cbinary.h"
#include "../cinchunk.h"
#include "../../model/cmesh.h"
#include "../../model/cmodel.h"
#include "../../exception/cfilenotexistexception.h"
#include "../../exception/cbadfileexception.h"

/**
 * C3DSImporter - class importing model from *.3DS file format
 * @author Michal Rost
 * @date 23.03.2008
 */
class C3DSImporter : public CObject {
public:
  static void import3DS(CModel &model, string fileName);
  static string getClassName() {
    return "C3DSImporter";
  }
protected:
  static void readRootChunk(fstream &fh, CModel &model);
  static void readRootSubChunk(CInChunk &chunk, CModel &model);
  static void readMeshes(CInChunk &chunk, CModel &model);
  static void readMesh(CInChunk &chunk, CModel &model);
  static void readMeshVerts(CInChunk &chunk, CMesh* mesh);
  static void readMeshCoords(CInChunk &chunk, CMesh* mesh);
  static void readMeshFaces(CInChunk &chunk, CMesh* mesh);
  static void readMeshMaterial(CInChunk &chunk, CModel &model, CMesh* mesh);
  static void readMaterials(CInChunk &chunk, CModel &model);
  static void readMaterial(CInChunk &chunk, CModel &model);
  static void readMaterialName(CInChunk &chunk, CMaterial* mat);
  static void readMaterialAmbient(CInChunk &chunk, CMaterial* mat);
  static void readMaterialDiffuse(CInChunk &chunk, CMaterial* mat);
  static void readMaterialSpecular(CInChunk &chunk, CMaterial* mat);
  static void readMaterialShininess(CInChunk &chunk, CMaterial* mat);
  static void readMaterialTransparency(CInChunk &chunk, CMaterial* mat);
  static void readMaterialMapFile(CInChunk &chunk, CMaterial* mat);
  static string read255CharChunk(CInChunk &chunk);
  static void convertPercentageValues(CModel &model);
};

#endif
